From 93e9c74ca9d96d57b45bff2e2a19cf14558fefbd Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 8 Jan 2004 04:15:04 +0000 Subject: [PATCH] Use stable creation times when reading waypoitns. --- gpsdrive.c | 7 ++++++- gpsutil.c | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gpsdrive.c b/gpsdrive.c index 2a785e1db..72b2bd575 100644 --- a/gpsdrive.c +++ b/gpsdrive.c @@ -78,6 +78,11 @@ data_read(void) waypoint *wpt_tmp; int linecount = 0; mkshort_rd_handle = mkshort_new_handle(); + /* + * Make sure that all waypoints in single read have same + * timestamp. + */ + time_t now = time(NULL); do { linecount++; @@ -122,7 +127,7 @@ data_read(void) s = csv_lineparse(NULL, " ", "", linecount); } - wpt_tmp->creation_time = time(NULL); + wpt_tmp->creation_time = now; /* We'll make up our own shortname. */ if (wpt_tmp->description) { diff --git a/gpsutil.c b/gpsutil.c index 41761c1a4..325a48989 100644 --- a/gpsutil.c +++ b/gpsutil.c @@ -56,6 +56,12 @@ data_read(void) char alttype; char icon[3] = {0}; waypoint *wpt_tmp; + /* + * Make sure that all waypoints in single read have same + * timestamp. + */ + time_t now = time(NULL); + for(;fgets(ibuf, sizeof(ibuf), file_in);) { /* A sharp in column zero or an blank line is a comment */ @@ -73,7 +79,7 @@ data_read(void) wpt_tmp->altitude = alt; wpt_tmp->shortname = xstrdup(name); wpt_tmp->description = xstrdup(desc); - wpt_tmp->creation_time = time(NULL); + wpt_tmp->creation_time = now; if (latdir == 'S') lat = -lat; if (londir == 'W') lon = -lon; -- 2.30.2